package cn.dong.edu.controller.api;

import cn.dong.edu.domain.dto.SubjectVo;
import cn.dong.edu.service.SubjectService;
import cn.dong.api.domain.CommonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/api/edu/subject")
@Slf4j
@RestController
public class ApiSubjectController {

    @Autowired
    private SubjectService subjectService;

    /**
     * 查询全部的科目分类，包括一级和二级
     * @return
     */
    @GetMapping("/findAll")
    public CommonResult findAll(){
        List<SubjectVo> list = subjectService.findAll();
        return CommonResult.ok().data(list);
    }

}
